package com.changgou.seckill.controller;

import com.changgou.entity.Result;
import com.changgou.entity.StatusCode;
import com.changgou.seckill.pojo.SecKillActivity;
import com.changgou.seckill.service.SecKillActivityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/secKillActivity")
public class SecKillActivityController {
    @Autowired
    private SecKillActivityService secKillActivityService;

    @PutMapping("/{id}/{status}")
    public Result updateById(@PathVariable("status") Integer status,@PathVariable("id") Integer id){
        secKillActivityService.updateById(status,id);
        return new Result(true, StatusCode.OK,"修改成功");
    }


    @DeleteMapping("{id}")
    public Result delById(@PathVariable("id") Integer id){
        secKillActivityService.delById(id);
        return new Result(true, StatusCode.OK,"删除成功");
    }

}
